@using k8s.Models
@using BlazorApp.Pages.Common.Html
@using BlazorApp.Pages.Common
@inherits BlazorApp.Pages.Common.PageBase

@if (RequestLimits != null && (RequestLimits.Limits is { Count: > 0 } || RequestLimits.Requests is { Count: > 0 } || RequestLimits.Claims is { Count: > 0 }))
{
    <HTableColumn Title=@L["Resource"] ExplainField="@ExplainField">

        @if (RequestLimits.Requests != null)
        {
            <Alert Type="@AlertType.Success">
                @L["Requests"]:
                @foreach (var (key, value) in RequestLimits.Requests)
                {
                    <ColorfulTag >@($"{key}={value}") </ColorfulTag>
                }
            </Alert>
        }
        @if (RequestLimits.Limits != null)
        {
            <Alert Type="@AlertType.Warning">
                @L["Limits"]:
                @foreach (var (key, value) in RequestLimits.Limits)
                {
                    <ColorfulTag >@($"{key}={value}") </ColorfulTag>
                }
            </Alert>
        }
        @if (RequestLimits.Claims != null)
        {
            <Alert Type="@AlertType.Warning">
                @L["Claims"]:
                @foreach (var c in RequestLimits.Claims)
                {
                    <ColorfulTag >@($"{c.Name}") </ColorfulTag>
                }
            </Alert>
        }
    </HTableColumn>
}

@code {

    [Parameter]
    public V1ResourceRequirements RequestLimits { get; set; }

    [Parameter]
    public string ExplainField { get; set; }

}
